package symbols;


import java.util.HashMap;

public class FSM_State {

    public final static int ASSIGN = -7;
    public final static int SINGLE_CHAR_KEYWORD = -6;
    public final static int IDENT = -5;
    public final static int NUMBER = -4;
    public final static int ERROR = -3;
    public final static int START = -2;
    public final static int EOF = -1;
    public static final HashMap<String, Morpheme.Codes> KEYWORDS = new HashMap<>();

    static {
        KEYWORDS.put("program", Morpheme.Codes.program);
        KEYWORDS.put("begin", Morpheme.Codes.begin);
        KEYWORDS.put("boolean", Morpheme.Codes.bool);
        KEYWORDS.put("integer", Morpheme.Codes.integer);
        KEYWORDS.put("read", Morpheme.Codes.read);
        KEYWORDS.put("end", Morpheme.Codes.end);
        KEYWORDS.put("print", Morpheme.Codes.print);
        KEYWORDS.put("fi", Morpheme.Codes.fi);
        KEYWORDS.put("if", Morpheme.Codes.ifStmt);
        KEYWORDS.put("then", Morpheme.Codes.then);
        KEYWORDS.put("do", Morpheme.Codes.doStmt);
        KEYWORDS.put("done", Morpheme.Codes.doneStmt);
        KEYWORDS.put("while", Morpheme.Codes.whileSmt);
        KEYWORDS.put("false", Morpheme.Codes.falseStmt);
        KEYWORDS.put("true", Morpheme.Codes.trueStmt);
        KEYWORDS.put("else", Morpheme.Codes.elseStmt);
    }

    private FSM_State() {
    }

    public static Morpheme.Codes getCode(final String read) {
        return KEYWORDS.containsKey(read.toLowerCase()) ? KEYWORDS.get(read.toLowerCase()) : Morpheme.Codes.ident;
    }
}
